//
//  DMMineViewCell.m
//  DMGME
//
//  Created by MC on 15/9/24.
//  Copyright (c) 2015年 GYP. All rights reserved.
//

#import "DMMineViewCell.h"
#import "DMMineModel.h"

@implementation DMMineViewCell

- (void)awakeFromNib {
    // Initialization code
}
-(void)setDmModel:(DMMineModel *)dmModel
{
    _dmModel = dmModel;
    _orderID.text = [NSString stringWithFormat:@"订单号: %@",dmModel.order_sn];
//    float fl = dmModel.all_total.floatValue +dmModel.coupon.floatValue;
    _orderSum.text = [NSString stringWithFormat:@"订单金额: ￥%@",dmModel.all_total];
    if (dmModel.subsidy == NULL) {
        _subsidiesMoney.text = [NSString stringWithFormat:@"补贴金额:￥0.00"];
    }else
    {
    _subsidiesMoney.text = [NSString stringWithFormat:@"补贴金额:￥%@",dmModel.subsidy];
    }
    //时间戳转化为时间字符串
//   NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:[dmModel.finish_time longLongValue]];
//    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
//    [formatter setDateFormat:@"yyyy-MM-dd HH:MM:ss"];
//    NSString *str = [formatter stringFromDate:date];
//    NSLog(@"date1:%@",str);
    NSString *str = [self timeStamaps:dmModel.finish_time];
    _orderFinishTime.text = [NSString stringWithFormat:@"订单完成时间: %@",str];
    
    UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.contentView.frame.size.height-1, KWidth, 1)];
    line.backgroundColor = [UIColor lightGrayColor];
    line.alpha = 0.4;
    [self.contentView addSubview:line];

}
-(NSString *)timeStamaps:(NSString *)str
{
    //时间戳转化为时间字符串
    NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:[str longLongValue]];
    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *string = [formatter stringFromDate:date];
    //    NSLog(@"date1:%@",str);
    return string;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
